package com.whc.controller;

import com.whc.result.Result;
import com.whc.service.MessageService;
import com.whc.vo.MessageVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author 韦红材
 * @ClassName MessageController
 * @data 2024/12/10 16:40
 * @Version V1.0
 **/
@Api(tags = "消息信息")
@RestController
@RequestMapping("/client/message")
@Slf4j
public class MessageController {
    @Autowired
    private MessageService messageService;

    @ApiOperation("查询所有消息")
    @GetMapping("/getAll")
    @PreAuthorize("hasAuthority('user')")
    public Result<List<MessageVo>> getALl(long senderId, long accepterId){
        List<MessageVo> messageVos = messageService.getAll(senderId, accepterId);
        return Result.success(messageVos);
    }
}
